import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import '../../../app_files.dart';
import 'action.dart';
import 'state.dart';

Widget buildView(
    EditInfoViewState state, Dispatch dispatch, ViewService viewService) {
  return GestureDetector(
    behavior: HitTestBehavior.translucent,
    onTap: () => FocusScope.of(viewService.context).requestFocus(FocusNode()),
    child: Scaffold(
      backgroundColor: Colors.white,
      appBar: myAppBar(viewService.context, title: '修改${state.title}'),
      body: Container(
        child: Column(
          children: <Widget>[
            Container(
              margin: EdgeInsets.only(left: 20, right: 20, top: 20),
              padding: EdgeInsets.only(left: 5, right: 5),
              child: Row(
                children: <Widget>[
                  Text(
                    '${state.title}：',
                    style: TextThemeConfig.Font15WithColor22,
                  ),
                  Padding(padding: EdgeInsets.only(left: 6)),
                  Expanded(
                    child: TextField(
                      controller: state.editingController,
                      decoration: InputDecoration(
                        border: InputBorder.none,
                        hintStyle: TextStyle(
                            color: ThemeConfig.black142Color, fontSize: 15),
                      ),
                    ),
                  ),
                ],
              ),
              decoration: BoxDecoration(
                color: Colors.white,
                border:
                    Border(bottom: BorderSide(color: ThemeConfig.separeColor)),
              ),
            ),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 35, vertical: 30),
              child: InkWell(
                child: Container(
                  height: 44,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(22)),
                    color: ThemeConfig.mainColor,
                  ),
                  child: Center(
                    child: Padding(
                      padding: EdgeInsets.only(bottom: 1),
                      child: Text(
                        '完成',
                        style: TextThemeConfig.Font14WithColorWhite,
                      ),
                    ),
                  ),
                ),
                onTap: () => dispatch(EditInfoViewActionCreator.onEdit()),
              ),
            ),
          ],
        ),
      ),
    ),
  );
}
